<template>
	<!-- 商品标签 -->
	<view class="e-flex e-m-b-16 e-flex-wrap e-m-t-12" v-if="label">
		<view class="e-line-1 e-font-20 " :style="{color: AppSkin.primary}">
			{{label}}
		</view>
	</view>
</template>

<script setup lang="ts">
	import type { GoodsItem } from '@/common/request/api'
	import { computed } from 'vue'
	const props = defineProps<{
		info : GoodsItem
	}>()

	const label = computed(() => {
		if (props.info.activity) {

			const goodsInfo = JSON.parse(JSON.stringify(props.info.activity))

			if (goodsInfo.label) {
				const list:Array<{name:string}> = JSON.parse(goodsInfo.label)
				if (list.length > 1) {
					let arr = list.filter((item, index) => index != 0)
					if (arr.length > 2) {
						arr.length = 2
					}
					return arr.map(item => item.name).join(`  |  `)
				}
			}
		}
		return ''
	})
</script>